package com.hr.service;

import com.hr.dao.DeedDAO;
import com.hr.model.Deed;
import com.hr.util.AuthUtil;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class DeedService
{
    @Autowired
    DeedDAO deedDAO;

    public List<Deed> getDeedsByDeeId(int deeid)
    {
        return deedDAO.getDeedsByDeeId(deeid);
    }

    public List<Deed> getDeedsByAId(int aid)
    {
        return deedDAO.getDeedsByAId(aid);
    }

    public void insertDeedByAId(Deed deed)
    {
        int aid= AuthUtil.getCurUser().getArchive().getId();
        deedDAO.insertDeedByAId(aid, deed);
    }

    public void updateDeed(Deed deed)
    {
        int aid= AuthUtil.getCurUser().getArchive().getId();
        deedDAO.updateDeed(aid,deed);
    }

    public void deleteDeed(int deeid)
    {
        deedDAO.deleteDeed(deeid);

    }
}
